<template>
  <div>
    <el-container>
      <el-header>
        <div class="header">
          <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" text-color="#333" router>
            <el-menu-item index="/user/info">个人资料</el-menu-item>
            <el-menu-item index="/user/account">资金账户</el-menu-item>
            <el-menu-item index="/user/address">地址管理</el-menu-item>
          </el-menu>
        </div>
      </el-header>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "user",
  data() {
    return {
      activeIndex: '/user/info',
    }
  },

  methods: {
    defaultActive() {
      this.activeIndex = this.$route.path
    },
  },
  mounted() {
    this.defaultActive();
  },
}
</script>

<style scoped>
* {
  background-color: #fff;
}

.el-container {
  background-color: rgb(242, 242, 242);
}

.header {
  width: 1140px;
  margin: 0 auto;
}
.el-main {
  width: 1140px;
  margin: 15px auto;
}
</style>
